<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>{{message}}</h1>
        <button @click="changeMessage">改变消息</button>
    </div>
</body>
<script src="../js/vue.js"></script>
<script>
    let vm = new Vue({
        el: "#app",
        data: {
            message:"hello"
        },
        // watch 用来监听消息 
        watch:{
            message:function(){
                console.log("监听到消息了")
            }
        },
        methods:{
            changeMessage:function(){
                this.message="hahahaha"
            }
        }
    })

</script>

</html>